define(function(require,exports,module){

  
    var tpl = require('../../tpl/member/friend_userInvite.tpl');//载入tpl模板
    var curId = $("#myInvite");
    var pagerid = "kkpagerInvite";
  //初始化显示表格、搜索
  require.async('./showTable',function(showTable){
    showTable.ajaxUrl('/member/friend/userInviteJSON.html?',tpl,curId,pagerid);
  });

  // 判断浏览器是否安装flash插件
  var flashChecker = function() 
  {
	  var hasFlash = 0; // 是否安装了flash
	  var flashVersion = 0; // flash版本

	  if (document.all) 
	  {
	      var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
	      if (swf) 
	      {
	        hasFlash = 1;
	        VSwf = swf.GetVariable("$version");
	        flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]);
	      }
	  }
	  else 
	  {
	      if (navigator.plugins && navigator.plugins.length > 0) 
	      {
	        var swf = navigator.plugins["Shockwave Flash"];
	        if (swf) 
	        {
	          hasFlash = 1;
	          var words = swf.description.split(" ");
	          for (var i = 0; i < words.length; ++i) 
	          {
	            if (isNaN(parseInt(words[i]))) continue;
	            flashVersion = parseInt(words[i]);
	          }
	        }
	      }
	  }
	  return {f:hasFlash,v:flashVersion};
	};



  $('#d_clip_button').on('click', function () {
    if (!flashChecker.f) 
    {
      //选择提示框
	    window.layer.open({
	          type: 1,
	          closeBtn: 1,
	          title: "&nbsp;",
	          area: ['450px', '190px'],
	          border: [1, 1, '#cecfd0'],
	          content: '<div class="tipsWrap w450"><div class="tipsTxt"><i class="iconfont tipIco">&#xe63c;</i><span>您的浏览器没有安装flash插件，现在安装？</span></div><div class="tipsBtnBar"><a href="javascript:;" class="okBtn">确认</a><a href="javascript:;" class="cancleBtn">取消</a></div></div>'
	          
	    });
      //确定
      $(".okBtn").live("click",function() {
        layer.closeAll();
        window.open("http://get.adobe.com/cn/flashplayer/");
      });
      //取消
      $(".cancleBtn").live("click",function() {
        layer.closeAll();
      });
    } 
  });
  require.async("/plugins/ZeroClipboard/ZeroClipboard",function(){
    var clip = new ZeroClipboard( document.getElementById("d_clip_button"), {
      moviePath: "/plugins/ZeroClipboard/ZeroClipboard.swf"
    });
    clip.on( 'complete', function(client, args) {
      $("#d_clip_button").html("复制成功");
    });
  });
});